package com.order.service.impl;

import com.order.service.OrderService;
import com.payment.client.PaymentClient;
import com.payment.client.request.PaymentRequest;
import com.payment.client.response.PaymentResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * dongzhihua
 * 2022/10/20 18:30
 */
@Slf4j
@Service("order-service-feign")
public class OrderServiceFeign implements OrderService {

    @Resource
    private PaymentClient paymentClient;

    @Override
    public String pay(Integer orderId) {
        PaymentRequest paymentRequest = new PaymentRequest();
        paymentRequest.setOrderNo(orderId + "");
        return paymentClient.pay(paymentRequest);
    }

    @Override
    public PaymentResponse get(Integer orderId) {
        PaymentRequest paymentRequest = new PaymentRequest();
        paymentRequest.setOrderNo(orderId + "");
        return paymentClient.get(paymentRequest);
    }
}
